home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tiger Disk 12
/
Tiger_Disk_012_19xx_Tiger-Crew-Disk_de_Side_B.d64
/
disk checker ii
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
4KB
|
134 lines
90 poke53280,11:poke53281,0:print"[153][147]"
100 print"disk checker[146] - jim butterfield":poke1170,48
110 dim a(255),c%(77,28),d%(1),n$(224),t%(224,1),s%(224,1),l%(224),r%(77)
120 d%(0)=58:d%(1)=42:z$=chr$(0)
130 data 1,17,20,24,19,30,17,35,16,0
140 data 65,17,20,24,18,30,17,35,16,0
150 data 67,39,28,53,26,64,24,77,22,0
160 b$=chr$(17):input"drive#(0-1)";d$:b$=chr$(3)
170 ifd$<>"0"andd$<>"1"goto160
180 open15,8,15,"i"+d$:gosub3020
190 open3,8,3,"$"+d$:gosub3020
200 a0=1:get#3,a$:a=asc(a$+z$)
210 reada1:ifa=a1goto250
220 f%=f%+1:iff%=3goto290
230 reada1:ifa1=0goto210
240 goto230
250 reada1:ifa1=0goto270
260 readb1:forj=a0toa1:r%(j)=b1:nextj:a0=j:goto250
270 ifa=1ora=65thend1=1:t9=35:s9=3:d9=18
280 ifa=67thend1=257:t9=77:s9=4:d9=39
290 ift9=0thenclose3:print:print"?? disk not recognized ??[153][146]":stop
300 rem****get and print bam****
310 print"[147] free block map"
315 print:print" : =used * =free":print
320 forj=1tod1:get#3,a$:nextj
330 forj=1tot9:t1=0
340 ifj=51thenget#3,a$,a$,a$,a$
350 get#3,a$:c=asc(a$+z$)
360 printright$(" "+str$(j),2);" ";
370 k1=0:fork=0tos9-1:get#3,a$:a=asc(a$+z$)
380 forl=0to7:a%=a/2:d1=a-a%*2:ifk1<=r%(j)thenc%(j,k1)=d1:printchr$(d%(d1));
390 a=a%:t1=t1+d1:k1=k1+1:nextl,k:print
400 ift1<>cthenprint"?";
410 nextj
420 rem do specific job
430 print"[147]":close3:print " choose --"
440 print "1. check all files"
450 print "2. check for bad spots"
460 print "3. recover scratched file"
470 print " your choice? ";
480 getx$:ifx$=""goto480
490 x=asc(x$)-48:ifx<1orx>3goto480
500 printx$:open2,8,2,"#0":gosub3020
510 onxgoto520,790,890
520 rem check files
530 t=d9:s=1
540 gosub2000
550 ford=2to255step32:ifa(d)<128goto590
560 d3=d3+1:t%(d3,0)=a(d+1):s%(d3,0)=a(d+2):l%(d3)=a(d+28)+a(d+29)*256
570 ifa(d)=132thent%(d3,1)=a(d+19):s%(d3,1)=a(d+20)
580 n$="":fork=d+3tod+18:n$=n$+chr$(a(k)):nextk:n$(d3)=n$
590 nextd
600 t=a(0):s=a(1):ift=d9goto540
610 ford=1tod3:l%=0
620 printn$(d);
630 t=t%(d,0):s=s%(d,0)
640 ift>t9ors<0thent=0
650 ift<1ors>r%(t)thenprint" bad chain":goto770
660 ifc%(t,s)=1thenprint" unallocated blocks":goto770
670 ifc%(t,s)>1thenprint" conflict ";n$(c%(t,s)-1):goto770
680 c%(t,s)=1+d
690 gosub3000
700 l%=l%+1
710 forj=0to1:print#15,"m-r";chr$(j);b$:get#15,a$
720 a(j)=asc(a$+z$):nextj
730 t4=t:s4=s:t=a(0):s=a(1):ift<>0ande=0goto640
740 t=t%(d,1):s=s%(d,1):t%(d,1)=0:ift<>0goto640
750 ifl%<>l%(d)thenprint" incorrect block count":goto770
760 print:print"[145] [145]"
770 nextd
780 print:printd3;"files":goto1270
790 rem scan sectors
800 iff%=0thenprint"sorry .. can't do it":goto1270
810 fort=1tot9:print"track";t
820 fors=0tor%(t)
830 print"[145] sect";s
840 gosub3000
850 nexts
860 print"[145] [145]"
870 nextt
880 print"disk ok":goto1270
890 rem unscratch
900 k=0:print"i will look for discarded files..."
910 t=d9:s=1
920 gosub2000
930 ford=2to255step32:ifa(d)<>0ora(d+1)=0goto980
940 ifk=0thenprint"do you want to recover:"
950 getx$:fork=d+3tod+18:printchr$(a(k));:nextk:print"? ";
960 getx$:ifx$<>"y"andx$<>"n"goto960
970 printx$:ifx$="y"goto1010
980 nextd
990 t=a(0):s=a(1):ift=d9goto920
1000 print"that's all ":goto1270
1010 t6=t:s6=s:d6=d:t=a(d+1):s=a(d+2):l%(0)=a(d+28)+a(d+29)*256:l%=0
1020 getx$:print"is this file:"
1030 print" 1. sequential"
1040 print" 2. program"
1050 print" 3. usr"
1060 ifa(d+19)=0goto1080
1070 print" 4. relative"
1080 print" which number? ";
1090 getx$:ifx$=""goto1090
1100 x=asc(x$)-48:ifx<1orx>4goto1090
1110 printx$:x=x+128
1120 ifx=132thent%(0,1)=a(d+19):s%(0,1)=a(d+20):ift%(0,1)=0goto1020
1130 ift>t9ors<0thent=0
1140 ift<1ors>r%(t)thenprint" bad chain!":goto1260
1150 ifc%(t,s)=0thenprint" allocated blocks!":goto1260
1160 gosub3000:l%=l%+1
1170 forj=0to1:print#15,"m-r";chr$(j);b$:get#15,a$
1180 a(j)=asc(a$+z$):nextj
1190 t4=t:s4=s:t=a(0):s=a(1):ift<>0goto1130
1200 t=t%(0,1):s=s%(0,1):t%(0,1)=0:ift<>0goto1130
1210 ifl%<>l%(0)thenprint" incorrect block count!":goto1260
1220 t=t6:s=s6:d=d6
1230 gosub3000
1240 print#15,"m-w";chr$(d);b$;chr$(1);chr$(x)
1250 print#15,"u2:2,";d$;t;s:gosub3020:goto1300
1260 print "sorry - it won't work"
1270 close2
1280 input"** got time to validate disk";x$
1290 ifasc(x$)=78thenend
1300 close2:print#15,"v";d$:end
2000 rem grab full disk block
2010 gosub3000
2020 forj=0to255:print#15,"m-r";chr$(j);b$:get#15,a$
2030 a(j)=asc(a$+z$):nextj:return
3000 rem read block
3010 print#15,"b-r:2,";d$;t;s
3020 rem get error status
3030 input#15,e,e$,e1,e2
3040 ife<>0thenprint"[158]disk error:[146][153]"e;e$,e1;e2
3050 return